home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / restaurante_1072.swf / scripts / __Packages / Customer.as < prev    next >
Text File  |  2009-04-16  |  14KB  |  386 lines

  1. if(true)
  2. {
  3.    if(true)
  4.    {
  5.       ┬º┬ºpush(false);
  6.    }
  7.    if(!┬º┬ºpop())
  8.    {
  9.       if(true)
  10.       {
  11.          if(true)
  12.          {
  13.             ┬º┬ºpush(false);
  14.          }
  15.          if(!┬º┬ºpop())
  16.          {
  17.             if(!_global.Customer)
  18.             {
  19.                _global.Customer extends MissionItem;
  20.                var _loc2_ = _global.Customer = function($mc, $type)
  21.                {
  22.                   super($mc);
  23.                   this._type = $type;
  24.                   this.__set__status(Customer.STAND);
  25.                   this.beginLoseHeart();
  26.                   var _loc3_ = Math.random();
  27.                   if(_loc3_ >= 0.5)
  28.                   {
  29.                      this.happy();
  30.                   }
  31.                   else
  32.                   {
  33.                      this.sad();
  34.                   }
  35.                }.prototype;
  36.                _loc2_.beginLoseHeart = function()
  37.                {
  38.                   this.lostHeartInterval = setInterval(this,"wait",1000);
  39.                };
  40.                _loc2_.happy = function()
  41.                {
  42.                   this.maxPatience = 30000;
  43.                };
  44.                _loc2_.sad = function()
  45.                {
  46.                   this.__get__mood().gotoAndStop("sad");
  47.                   this.maxPatience = 15000;
  48.                };
  49.                _loc2_.stopLoseHeart = function()
  50.                {
  51.                   clearInterval(this.lostHeartInterval);
  52.                };
  53.                _loc2_.__get__isDragging = function()
  54.                {
  55.                   return this._isDragging;
  56.                };
  57.                _loc2_.__get__mood = function()
  58.                {
  59.                   return MovieClip(this.__get__mc().mood);
  60.                };
  61.                _loc2_.__set__status = function(value)
  62.                {
  63.                   super.__set__status(value);
  64.                   this.refreshDirection();
  65.                   this.refreshHearts();
  66.                   return this.__get__status();
  67.                };
  68.                _loc2_.__get__directionNow = function()
  69.                {
  70.                   return this.direction;
  71.                };
  72.                _loc2_.__get__table = function()
  73.                {
  74.                   return this._table;
  75.                };
  76.                _loc2_.__get__CLASS = function()
  77.                {
  78.                   return Customer;
  79.                };
  80.                _loc2_.__set__mc = function(value)
  81.                {
  82.                   this._mc = value;
  83.                   this.__get__mc().gotoAndStop(this.__get__status());
  84.                   this.refreshDirection();
  85.                   this.refreshHearts();
  86.                   return this.__get__mc();
  87.                };
  88.                _loc2_.__get__type = function()
  89.                {
  90.                   return this._type;
  91.                };
  92.                _loc2_.__get__numHearts = function()
  93.                {
  94.                   return this._numHearts;
  95.                };
  96.                _loc2_.setDirection = function(d)
  97.                {
  98.                   this.direction = d;
  99.                   this.refreshDirection();
  100.                };
  101.                _loc2_.terminate = function()
  102.                {
  103.                   this.__get__mc().removeMovieClip();
  104.                   this.stopLoseHeart();
  105.                   false;
  106.                };
  107.                _loc2_.changeHearts = function(h)
  108.                {
  109.                   if(h > 0)
  110.                   {
  111.                      this.plusHearts(h);
  112.                   }
  113.                   else
  114.                   {
  115.                      if(h >= 0)
  116.                      {
  117.                         return this.__get__numHearts();
  118.                      }
  119.                      this.minusHearts(h * -1);
  120.                   }
  121.                   this.refreshHearts();
  122.                   return this.__get__numHearts();
  123.                };
  124.                _loc2_.leave = function(fromTable)
  125.                {
  126.                   if(this.__get__table() && !fromTable && this.__get__status() == Customer.SIT)
  127.                   {
  128.                      this.__get__table().customersLeave(this);
  129.                   }
  130.                   if(fromTable)
  131.                   {
  132.                      this._numHearts = 1;
  133.                      this.refreshHearts();
  134.                      this.__get__mc()[MissionData.DATA[Mission.getMission().__get__id()].customer.status].gotoAndStop("angry");
  135.                   }
  136.                   if(this.__get__status() == Customer.STAND)
  137.                   {
  138.                      Mission.getMission().__get__door().customerLeave(this);
  139.                   }
  140.                   if(!this.__get__table())
  141.                   {
  142.                      this.terminate();
  143.                   }
  144.                };
  145.                _loc2_.refreshDirection = function()
  146.                {
  147.                   this.__get__mc()[this.__get__status()].gotoAndStop(this.direction);
  148.                };
  149.                _loc2_.plusHearts = function(h)
  150.                {
  151.                   this._numHearts += h;
  152.                   this._numHearts = this._numHearts <= Customer.MAXNUMHEARTS ? this._numHearts : Customer.MAXNUMHEARTS;
  153.                   return this.__get__numHearts();
  154.                };
  155.                _loc2_.minusHearts = function(h)
  156.                {
  157.                   if(this._numHearts > 0)
  158.                   {
  159.                      this._numHearts -= h;
  160.                   }
  161.                   if(this._numHearts <= 0)
  162.                   {
  163.                      this.leave();
  164.                      this.__get__mc()[MissionData.DATA[Mission.getMission().__get__id()].customer.status].gotoAndStop("angry");
  165.                      return 0;
  166.                   }
  167.                   return this.__get__numHearts();
  168.                };
  169.                _loc2_.refreshHearts = function()
  170.                {
  171.                   var obj = this;
  172.                   var _loc2_ = MissionData.DATA[Mission.getMission().__get__id()];
  173.                   this.__get__mc()[_loc2_.customer.status].gotoAndStop(this.__get__numHearts());
  174.                   if(!this.__get__mood()._visible)
  175.                   {
  176.                      this.__get__mood()._visible = true;
  177.                      var interval = setInterval(function()
  178.                      {
  179.                         obj.__get__mood()._visible = false;
  180.                         clearInterval(interval);
  181.                      }
  182.                      ,2000);
  183.                   }
  184.                   if(this.__get__numHearts() >= 5)
  185.                   {
  186.                      this.__get__mood().gotoAndStop("happy");
  187.                   }
  188.                   else if(this.__get__numHearts() >= 3)
  189.                   {
  190.                      this.__get__mood().gotoAndStop("general");
  191.                   }
  192.                   else
  193.                   {
  194.                      this.__get__mood().gotoAndStop("sad");
  195.                   }
  196.                   return this.__get__numHearts();
  197.                };
  198.                _loc2_.wait = function()
  199.                {
  200.                   this.patience -= 1000;
  201.                   if(this.patience <= 0)
  202.                   {
  203.                      this.patience = this.maxPatience;
  204.                      this.changeHearts(-1);
  205.                   }
  206.                };
  207.                _loc2_.standHandle = function()
  208.                {
  209.                   var obj = this;
  210.                   this.__get__mc().onPress = function()
  211.                   {
  212.                      obj.__get__mc().startDrag();
  213.                      Mission.getMission().draggingMc = this;
  214.                      this.swapDepths(Mission.getMission().__get__mc().getNextHighestDepth());
  215.                      obj._isDragging = true;
  216.                      this.onMouseMove = function()
  217.                      {
  218.                         obj.onMouseMoveWhenStand();
  219.                         updateAfterEvent();
  220.                      };
  221.                   };
  222.                   this.__get__mc().onRelease = this.__get__mc().onReleaseOutside = function()
  223.                   {
  224.                      obj.__get__mc().stopDrag();
  225.                      Mission.getMission().draggingMc = null;
  226.                      obj._isDragging = false;
  227.                      obj.__get__mc().onMouseMove = null;
  228.                      obj.mcDropped();
  229.                      Mission.getMission().__get__door().refresh();
  230.                   };
  231.                };
  232.                _loc2_.onMouseMoveWhenStand = function()
  233.                {
  234.                   if(this.__get__table() == null)
  235.                   {
  236.                      this._table = this.getTouchTable();
  237.                   }
  238.                   else if(McTools.isMouseInMc(this.__get__table().__get__mc()))
  239.                   {
  240.                      this.__get__table().onRollOver();
  241.                   }
  242.                   else
  243.                   {
  244.                      this.__get__table().onRollOut();
  245.                      this._table = null;
  246.                   }
  247.                };
  248.                _loc2_.sitHandle = function()
  249.                {
  250.                   this.__get__mc().onPress = null;
  251.                   this.__get__mc().onMouseMove = null;
  252.                   this.__get__mc().onRelease = null;
  253.                };
  254.                _loc2_.mcDropped = function()
  255.                {
  256.                   this._table = this.getTouchTable();
  257.                   if(this.__get__table() != null)
  258.                   {
  259.                      this.__get__table().onRollOut();
  260.                      this.__get__table().addCustomer(this);
  261.                   }
  262.                   else
  263.                   {
  264.                      Mission.getMission().__get__door().refresh();
  265.                   }
  266.                };
  267.                _loc2_.getTouchTable = function()
  268.                {
  269.                   var _loc2_ = Mission.getMission().__get__tables();
  270.                   var _loc1_ = 0;
  271.                   while(_loc1_ < _loc2_.length)
  272.                   {
  273.                      if(McTools.isMouseInMc(_loc2_[_loc1_].mc) && Table(_loc2_[_loc1_]).__get__isNotFull() && Table(_loc2_[_loc1_]).__get__numCustomers() < Table(_loc2_[_loc1_]).__get__maxNumCustomers())
  274.                      {
  275.                         return _loc2_[_loc1_];
  276.                      }
  277.                      _loc1_ = _loc1_ + 1;
  278.                   }
  279.                   return null;
  280.                };
  281.                _loc2_.toString = function()
  282.                {
  283.                   return CustomerType.__get__TYPES()[this.__get__type()];
  284.                };
  285.                _global.Customer = function($mc, $type)
  286.                {
  287.                   super($mc);
  288.                   this._type = $type;
  289.                   this.__set__status(Customer.STAND);
  290.                   this.beginLoseHeart();
  291.                   var _loc3_ = Math.random();
  292.                   if(_loc3_ >= 0.5)
  293.                   {
  294.                      this.happy();
  295.                   }
  296.                   else
  297.                   {
  298.                      this.sad();
  299.                   }
  300.                }.STAND = "stand";
  301.                _global.Customer = function($mc, $type)
  302.                {
  303.                   super($mc);
  304.                   this._type = $type;
  305.                   this.__set__status(Customer.STAND);
  306.                   this.beginLoseHeart();
  307.                   var _loc3_ = Math.random();
  308.                   if(_loc3_ >= 0.5)
  309.                   {
  310.                      this.happy();
  311.                   }
  312.                   else
  313.                   {
  314.                      this.sad();
  315.                   }
  316.                }.SIT = "sit";
  317.                _global.Customer = function($mc, $type)
  318.                {
  319.                   super($mc);
  320.                   this._type = $type;
  321.                   this.__set__status(Customer.STAND);
  322.                   this.beginLoseHeart();
  323.                   var _loc3_ = Math.random();
  324.                   if(_loc3_ >= 0.5)
  325.                   {
  326.                      this.happy();
  327.                   }
  328.                   else
  329.                   {
  330.                      this.sad();
  331.                   }
  332.                }.MAXNUMHEARTS = 6;
  333.                _loc2_._numHearts = 3;
  334.                _loc2_.direction = 3;
  335.                _loc2_._type = 0;
  336.                _loc2_._table = null;
  337.                _loc2_.maxPatience = 30000;
  338.                _loc2_.patience = 30000;
  339.                _loc2_._isDragging = false;
  340.                ┬º┬ºpush(_loc2_.addProperty("CLASS",_loc2_.__get__CLASS,function()
  341.                {
  342.                }
  343.                ));
  344.                ┬º┬ºpush(_loc2_.addProperty("directionNow",_loc2_.__get__directionNow,function()
  345.                {
  346.                }
  347.                ));
  348.                ┬º┬ºpush(_loc2_.addProperty("isDragging",_loc2_.__get__isDragging,function()
  349.                {
  350.                }
  351.                ));
  352.                ┬º┬ºpush(_loc2_.addProperty("mc",function()
  353.                {
  354.                }
  355.                ,_loc2_.__set__mc));
  356.                ┬º┬ºpush(_loc2_.addProperty("mood",_loc2_.__get__mood,function()
  357.                {
  358.                }
  359.                ));
  360.                ┬º┬ºpush(_loc2_.addProperty("numHearts",_loc2_.__get__numHearts,function()
  361.                {
  362.                }
  363.                ));
  364.                ┬º┬ºpush(_loc2_.addProperty("status",function()
  365.                {
  366.                }
  367.                ,_loc2_.__set__status));
  368.                ┬º┬ºpush(_loc2_.addProperty("table",_loc2_.__get__table,function()
  369.                {
  370.                }
  371.                ));
  372.                ┬º┬ºpush(_loc2_.addProperty("type",_loc2_.__get__type,function()
  373.                {
  374.                }
  375.                ));
  376.                ┬º┬ºpush(ASSetPropFlags(_global.Customer.prototype,null,1));
  377.             }
  378.             ┬º┬ºpop();
  379.          }
  380.       }
  381.       ┬º┬ºgoto(addr882);
  382.    }
  383.    ┬º┬ºpush([]);
  384. }
  385. addr882:
  386.